using System;

using System.Configuration;


namespace TimelineNet.Library {
    [Serializable()]
    public abstract class Band {
        public int Width;
        public Enums.TimelineDateTime TimelineDateTime;
        public int IntervalPixels = 0;
        public EventSource EventSource;
        public System.DateTime InitialDate;
        public int Timezone = Timeline.LocalTimezoneOffSet;
        public bool Overview;
        public decimal TrackGap = 0;
        public decimal TrackHeight = 0;
        public int SynchWith = -1;
        public bool Highlight = false;
        public Theme Theme;
        public bool ShowEventText = true;

        public ThumbnailEventPainter ThumbnailEventPainter;

        public Band() { }
        public Band(int width, Enums.TimelineDateTime TimelineDateTime, int intervalPixels, EventSource EventSource, Theme Theme, System.DateTime InitialDate, int Timezone, bool Overview, decimal TrackGap, decimal trackHeight)
        {
            
            this.Width = width;
            this.Theme = Theme;
            this.TimelineDateTime = TimelineDateTime;
            this.IntervalPixels = intervalPixels;
            this.EventSource = EventSource;
            this.InitialDate = InitialDate;
            this.Timezone = Timezone;
            this.Overview = Overview;
            this.TrackGap = TrackGap;
            this.TrackHeight = trackHeight;

        }
        public Band(int width, Enums.TimelineDateTime TimelineDateTime, int intervalPixels) {

            this.Width = width;
            this.TimelineDateTime = TimelineDateTime;
            this.IntervalPixels = intervalPixels;
        }

        public override string ToString() {



            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            sb.Append(string.Format("overview: {0}\n", Overview.ToString().ToLower()));

            if(TrackHeight > 0) sb.Append(string.Format(",trackHeight: {0}\n", TrackHeight));
            if(TrackGap > 0) sb.Append(string.Format(",trackGap: {0}\n", TrackGap));
            if(Width != null) sb.Append(string.Format(",width:          \"{0}%\"\n", Width));
            sb.Append(string.Format(",intervalUnit:   Timeline.DateTime.{0}\n", TimelineDateTime.ToString()));
            if(IntervalPixels > 0) sb.Append(string.Format(",intervalPixels: {0}\n", IntervalPixels));
            if(EventSource != null) sb.Append(string.Format(",eventSource: {0}\n", EventSource.Name));
            if(ShowEventText != true) sb.Append(string.Format(",showEventText: {0}\n", ShowEventText.ToString().ToLower()));
            if(Theme != null && Theme.Name != null) sb.Append(string.Format(",theme: {0}\n", Theme.ThemeClientID));
            if(InitialDate != null && InitialDate != DateTime.MinValue)
            {
                sb.Append(string.Format(",date: new Date('{0}')\n", Timeline.FormatDate(InitialDate)));                

            }
            if(Timezone != -99 && Timezone != 0) sb.Append(string.Format(",timeZone: {0}\n", Timezone));

            return sb.ToString();
            /*
           Timeline.createBandInfo({
            width:          "70%", 
            intervalUnit:   Timeline.DateTime.MONTH, 
            intervalPixels: 100
        })
         
             */
        }
    }
}